local yongsi = fk.CreateSkill {
  name = "lvshi__yongsi",
  tags = { Skill.Compulsory }
}
local TT = require "packages/tuntian_studio/utility"
local DIY = require "packages/diy_utility/diy_utility"

Fk:loadTranslationTable{
  ["lvshi__yongsi"] = "庸肆",
  [":lvshi__yongsi"] = "锁定技，摸牌阶段，你额外摸三张牌，然后明置五张牌；若你有明置牌，你不能使用暗置牌。",
  ["#lvshi__yongsi"] = "庸肆：请明置五张牌",

  ["$lvshi__yongsi"] = "既登九五之尊位，何惧为冢中之枯骨？",
  ["~lvshi__yuanshu"] = "我的蜜水，哪里去了。。",
}

yongsi:addEffect(fk.DrawNCards, {
  on_use = function(self, event, target, player, data)
    data.n = data.n + 3
  end,
})

yongsi:addEffect(fk.AfterDrawNCards, {
  on_use = function(self, event, target, player, data)
    if player:isKongcheng() then return end
    local cards = table.filter(player:getCardIds("h"), function (id)
      return not TT.isShown(id)
    end)
    if #cards > 0 then
      cards = player.room:askToCards(player, {
        min_num = math.min(#cards, 5),
        max_num = 5,
        include_equip = false,
        pattern = tostring(Exppattern{ id = cards }),
        skill_name = yongsi.name,
        cancelable = false,
        prompt = "#lvshi__yongsi"
      })
      DIY.showCards(player, cards)
    end
  end,
})

yongsi:addEffect("prohibit", {
  prohibit_use = function (self, player, card)
    if player:hasSkill(yongsi.name) and #DIY.getShownCards(player) > 0 then
      local id = card:getEffectiveId()
      if table.contains(player:getHandlyIds(), id) and not TT.isShown(id) then
        return true
      end
    end
  end,
})


return yongsi